package org.wishwork.api.base;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wishwork.api.base.logistics.LogisticsApi;
import org.wishwork.api.base.logistics.LogisticsRequest;
import org.wishwork.api.base.logistics.LogisticsResponse;
import org.wishwork.api.base.shop.ShopApi;
import org.wishwork.api.base.shop.ShopRequest;
import org.wishwork.api.base.shop.ShopResponse;
import org.wishwork.api.base.wms.WmsApi;
import org.wishwork.api.base.wms.WmsRequest;
import org.wishwork.api.base.wms.WmsResponse;
import org.wishwork.context.Context;

import java.util.List;

/**
 * @description: 基础Api
 * @author: WangYX
 * @create: 2022-04-02 14:44
 * @Version: 1.0.0
 **/

public class BaseApi {

    private static final Logger log = LoggerFactory.getLogger(BaseApi.class);

    private Context context;

    private final ShopApi shopApi;
    private final WmsApi wmsApi;
    private final LogisticsApi logisticsApi;

    public BaseApi(Context context) {
        this.context = context;
        this.shopApi = new ShopApi(context);
        this.wmsApi = new WmsApi(context);
        this.logisticsApi = new LogisticsApi(context);
    }

    /**
     * 店铺查询
     *
     * @param shopRequest
     * @return
     * @throws Exception
     */
    public List<ShopResponse> shop(ShopRequest shopRequest) throws Exception {
        return this.shopApi.business(shopRequest);
    }

    /**
     * 仓库查询
     *
     * @param wmsRequest
     * @return
     * @throws Exception
     */
    public List<WmsResponse> wms(WmsRequest wmsRequest) throws Exception {
        return this.wmsApi.business(wmsRequest);
    }

    /**
     * 物流查询
     *
     * @param logisticsRequest
     * @return
     * @throws Exception
     */
    public List<LogisticsResponse> logistics(LogisticsRequest logisticsRequest) throws Exception {
        return this.logisticsApi.business(logisticsRequest);
    }


}
